package com.blacktry.controller;


import com.blacktry.entity.enums.OprLogConst;
import com.blacktry.entity.model.ApiResult;
import com.blacktry.entity.model.Vo.Daily;
import com.blacktry.service.TimetableService;
import com.blacktry.utils.ApiResultHandler;
import com.blacktry.utils.log.OperLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author blackTry
 * @since 2021-12-08
 */
@Api(value = "课表日历模块", tags = "课表日历接口")
@RestController
@RequestMapping("/timetable")
public class TimetableController {
    @Autowired
    private TimetableService timetableService;


    @OperLog(operModul = "课表日历模块-根据username查看老师的上课时间",operType = OprLogConst.SELECT,operDesc = "根据username查看老师的上课时间")
    @ApiOperation("根据username查看老师的上课时间")
    @GetMapping("/selectTime")
    public ApiResult<Map<String,String>> selectTime(@RequestParam("username") String username){
        return ApiResultHandler.buildApiResult(200,"成功",timetableService.selectTime(username));
    }


    @OperLog(operModul = "课表日历模块-根据username和时间查看具体安排",operType = OprLogConst.SELECT,operDesc = "根据username和时间查看具体安排")
    @ApiOperation("根据username和时间查看具体安排")
    @GetMapping("/selectDaySchedule")
    public ApiResult<Map<String, Daily>> selectDaySchedule(@RequestParam("username") String username, @RequestParam("day") String day){
        return ApiResultHandler.buildApiResult(200,"成功",timetableService.selectDaySchedule(username,day));
    }

}

